package org.yangspring.samples.mvc.serviceOracle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yangspring.samples.mvc.daoOracle.DBATablesDAO;
import org.yangspring.samples.mvc.domainOracle.DBATables;

import java.util.List;

import static java.lang.System.out;

/**
 * Created by franklin on 6/24/2017.
 */

@Service
public class DBATablesServiceImpl implements DBATablesService {

    private static final Logger logger = LoggerFactory.getLogger(DBATablesServiceImpl.class);

    @Autowired
    private DBATablesDAO dbaTablesDao;
//    public void setDbaTablesDao(DBATablesDAO dbaTablesDao){
//        this.dbaTablesDao = dbaTablesDao;
//    }

    @Transactional
    public List<DBATables> listDbaTables(){
        logger.warn("\nOracle DBATablesServiceImpl\n");
        return this.dbaTablesDao.listDbaTables();
    }

    @Transactional
    public List<DBATables> listDbaTables4Owner(String owner){
        logger.warn("\nOracle DBATablesServiceImpl for Owner\n");
        return this.dbaTablesDao.listDbaTables4Owner(owner);
    }

    @Transactional
    public List<DBATables> listDbaTables4Name(String name){
        logger.warn("\nOracle DBATablesServiceImpl for Owner\n");
        return this.dbaTablesDao.listDbaTables4Name4Name(name);
    }

    @Transactional
    public List<DBATables> listDbaTables4NameOwner(String owner, String name){
        logger.warn("\nOracle DBATablesServiceImpl for Owner\n");
        return this.dbaTablesDao.listDbaTables4NameOwner(name, owner);
    }

}
